Find the number of notesΒΆ

Find the number of notes
(sample of notes: 10, 20, 50, 100, 200 and 500 )
against an given amount.
Range - Number of notes(N) : N (1 = N = 1000000).
def num_notes(a):
    Q = [500, 200, 100, 50, 20, 10]
    x = 0
    for i in range(6):
        q = Q[i]
        x += int(a / q)
        a = int(a % q)
    if a > 0:
        x = -1
    return x

print(num_notes(880))
print(num_notes(1000))

Output:

6
2